package com.ruoyi.restaurant.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单主表 tb_order
 *
 * @author ruoyi
 */
public class Order extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 订单ID
     */
    @Excel(name = "订单ID", cellType = Excel.ColumnType.NUMERIC)
    private Long id;

    /**
     * 订单号
     */
    @Excel(name = "订单号")
    @NotBlank(message = "订单号不能为空")
    private String orderNumber;

    /**
     * 餐台ID
     */
    @Excel(name = "餐台ID")
    @NotNull(message = "餐台ID不能为空")
    private Long tableId;

    /**
     * 餐台号
     */
    @Excel(name = "餐台号")
    private String tableNumber;

    /**
     * 服务员姓名
     */
    @Excel(name = "服务员")
    private String waiterName;

    /**
     * 就餐人数
     */
    @Excel(name = "就餐人数")
    private Integer guestCount;

    /**
     * 订单总金额
     */
    @Excel(name = "总金额")
    private BigDecimal totalAmount;

    /**
     * 原始金额（结账前的总金额）
     */
    @Excel(name = "原始金额")
    private BigDecimal originalAmount;

    /**
     * 优惠金额（原始金额 - 实收金额）
     */
    @Excel(name = "优惠金额")
    private BigDecimal discountAmount;

    /**
     * 实收金额（实际收取的金额）
     */
    @Excel(name = "实收金额")
    private BigDecimal actualAmount;

    /**
     * 订单状态（0-进行中 1-已结账）
     */
    @Excel(name = "订单状态", readConverterExp = "0=进行中,1=已结账")
    private String status;

    /**
     * 开台时间
     */
    @Excel(name = "开台时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date openTime;

    /**
     * 结账时间
     */
    @Excel(name = "结账时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date checkoutTime;

    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Excel(name = "更新时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 订单明细列表
     */
    private List<OrderDetail> orderDetails;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Long getTableId() {
        return tableId;
    }

    public void setTableId(Long tableId) {
        this.tableId = tableId;
    }

    public String getTableNumber() {
        return tableNumber;
    }

    public void setTableNumber(String tableNumber) {
        this.tableNumber = tableNumber;
    }

    public String getWaiterName() {
        return waiterName;
    }

    public void setWaiterName(String waiterName) {
        this.waiterName = waiterName;
    }

    public Integer getGuestCount() {
        return guestCount;
    }

    public void setGuestCount(Integer guestCount) {
        this.guestCount = guestCount;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getOriginalAmount() {
        return originalAmount;
    }

    public void setOriginalAmount(BigDecimal originalAmount) {
        this.originalAmount = originalAmount;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getActualAmount() {
        return actualAmount;
    }

    public void setActualAmount(BigDecimal actualAmount) {
        this.actualAmount = actualAmount;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getOpenTime() {
        return openTime;
    }

    public void setOpenTime(Date openTime) {
        this.openTime = openTime;
    }

    public Date getCheckoutTime() {
        return checkoutTime;
    }

    public void setCheckoutTime(Date checkoutTime) {
        this.checkoutTime = checkoutTime;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public Date getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public List<OrderDetail> getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(List<OrderDetail> orderDetails) {
        this.orderDetails = orderDetails;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("orderNumber", getOrderNumber())
                .append("tableId", getTableId())
                .append("tableNumber", getTableNumber())
                .append("waiterName", getWaiterName())
                .append("guestCount", getGuestCount())
                .append("totalAmount", getTotalAmount())
                .append("status", getStatus())
                .append("openTime", getOpenTime())
                .append("checkoutTime", getCheckoutTime())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}

